﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Text;

namespace DreamBox.Net.Web
{
    /// <summary>
    /// Razor视图模板基类
    /// </summary>
    public class ViewPage
    {

        private StringBuilder result = new StringBuilder();

        /// <summary>
        /// 视图最终输出的HTML
        /// </summary>
        public StringBuilder ResultBuilder
        {
            get { return result; }
        }

        public HtmlHelper Html
        {
            get;
            set;
        }

        public void WriteAttribute(string attName, Tuple<string, int> t1, Tuple<string, int> t2, Tuple<Tuple<string, Int32>, Tuple<object, int>, bool> t3)
        {
            result.Append(t1.Item1);
            result.Append(t3.Item1.Item1);
            result.Append(t3.Item2.Item1);
            result.Append(t2.Item1);
        }
        public void WriteAttribute(string attName, Tuple<string, int> t1, Tuple<string, int> t2, Tuple<Tuple<string, int>, Tuple<string, int>, bool> t3, Tuple<Tuple<string, Int32>, Tuple<object, int>, bool> t4)
        {
            result.Append(t1.Item1);
            result.Append(t3.Item1.Item1);
            result.Append(t3.Item2.Item1);
            result.Append(t4.Item1.Item1);
            result.Append(t4.Item2.Item1);
            result.Append(t2.Item1);
        }
        public void WriteAttribute(string attName, Tuple<string, int> t1, Tuple<string, int> t2, Tuple<Tuple<string, int>, Tuple<string, int>, bool> t3, Tuple<Tuple<string, int>, Tuple<object, System.Int32>, bool> t4, Tuple<Tuple<string, int>, Tuple<string, int>, bool> t5)
        {
            result.Append(t1.Item1);
            result.Append(t3.Item2.Item1);
            result.Append(t4.Item2.Item1);
            result.Append(t5.Item2.Item1);
            result.Append(t2.Item1);
        }
        public void WriteAttribute(string attName, Tuple<string, int> t1, Tuple<string, int> t2, Tuple<Tuple<string, int>, Tuple<string, int>, bool> t3, Tuple<Tuple<string, int>, Tuple<object, System.Int32>, bool> t4, Tuple<Tuple<string, int>, Tuple<string, int>, bool> t5, Tuple<Tuple<string, Int32>, Tuple<object, int>, bool> t6)
        {
            result.Append(t1.Item1);
            result.Append(t3.Item2.Item1);
            result.Append(t4.Item2.Item1);
            result.Append(t5.Item2.Item1);
            result.Append(t6.Item2.Item1);
            result.Append(t2.Item1);
        }
        public void WriteAttribute(string attName, Tuple<string, int> t1, Tuple<string, int> t2, Tuple<Tuple<string, int>, Tuple<string, int>, bool> t3, Tuple<Tuple<string, int>, Tuple<object, System.Int32>, bool> t4, Tuple<Tuple<string, int>, Tuple<string, int>, bool> t5, Tuple<Tuple<string, Int32>, Tuple<object, int>, bool> t6, Tuple<Tuple<string, int>, Tuple<string, int>, bool> t7)
        {
            result.Append(t1.Item1);
            result.Append(t3.Item2.Item1);
            result.Append(t4.Item2.Item1);
            result.Append(t5.Item2.Item1);
            result.Append(t6.Item2.Item1);
            result.Append(t7.Item2.Item1);
            result.Append(t2.Item1);
        }
        public void WriteLiteral(string literal)
        {
            result.Append(literal);
        }
        public void WriteLiteral(object literal)
        {
            result.Append(literal.ToString());
        }
        public virtual void Execute() { }
        public void Write(object obj)
        {
            result.Append(obj.ToString());
        }
    }
}
